#! /usr/bin/env python
# -*- coding: utf-8 -*-

import pyglet
import sys, os

def parse_dir(directory):
    for name in os.listdir(directory):
        path = os.path.join(directory, name)
        if os.path.isdir(path):
            if name.startswith(".") and len(name)>1:
                continue
            pyglet.resource.path.append(path)
            parse_dir(path)
            

# Add data-directories to path
datapath = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data") 
pyglet.resource.path.append(datapath)
parse_dir(datapath)
pyglet.resource.reindex()

if len(sys.argv) > 1 and sys.argv[1] == "--editor":
    del sys.argv[1]
    from gamelib import map_editor
    map_editor.main()
else:
    from gamelib import main
    main.main()
    #from gamelib import dialogbox
    #dialogbox.test()
